<?
/*
 *  GGB - Gelin's Guest Book.
 *  Copyright (C) 2006-2009 Denis Nelubin aka Gelin
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *  http://gelin.ru
 *  mailto:den@gelin.ru
 *
 *  Description:    RSS page.
 *
 *  History:
 *  2007-07-22  Gelin   Initially created.
 *  2009-11-02  Gelin   added 'rss-new' action
 *
 */

header('Content-type: text/xml; charset=UTF-8');

session_start();
require_once('lib/functions.php');

//define profile
$profile = getParameter('profile');
if (!isset($profile) || !is_readable("profile/$profile.php")) {
    $profile = 'default';
}
$_SESSION['profile'] = $profile;
require_once("profile/$profile.php");

require_once($config['require']['storage']);
require_once($config['require']['rss_formatter']);
require_once($config['require']['logger']);

//create logger
$log = new Logger();
$log->restore();

//create storage
$storage = new Storage();

//create formatter
$format = new RssFormatter();

//dispatch by action
$action = getParameter('action');

switch ($action) {
case 'rss-new':
    require_once('action/rss-new.php'); //new messages, not approved
    break;
default:
    require_once('action/rss.php');
}

?>